package com.neusoft.service.impl;

import com.neusoft.mapper.CouponMapper;
import com.neusoft.po.Coupon;
import com.neusoft.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouponServiceImpl implements CouponService {

    @Autowired
    private CouponMapper couponMapper;

    @Override
    public List<Coupon> listCouponByUserId(String userId) {
        return couponMapper.listCouponByUserId(userId);
    }
    
    @Override
    public List<Coupon> listCouponByAmount(String userId, double amount) {
    	return couponMapper.listCouponByAmount(userId, amount);
    }

    @Override
    public Integer addCoupon(String userId, String couponName, double threshold, double discount) {
        return couponMapper.addCoupon(userId, couponName, threshold, discount);
    }

    @Override
    public Integer useCoupon(String userId, Integer couponId) {
        return couponMapper.useCoupon(userId, couponId);
    }
}
